home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
amalnet.k12.il
/
www4.amalnet.k12.il.tar
/
www4.amalnet.k12.il
/
Fix buffer overrun Office 2003 _heb.rar
/
MicrosoftFixit50255.msi
/
Binary.HEBREWSCRIPT
< prev
next >
Wrap
Text File
|
2009-11-02
|
3KB
|
93 lines
'
' steps:
' look in Application data folder\Microsoft\Proof for .dic files
' rename all .dic files to .old
' copy the contents of
option explicit
' reference:
' http://www.microsoft.com/technet/scriptcenter/guide/sas_fil_higv.mspx?mfr=true
const APPLICATION_DATA_INDEX = &H1a&
const ForReading = 1
const ForWriting = 2
dim oShellApp
dim oFileSys
dim oShell
dim oFolder
dim oFolderItem
dim strProofDir
dim oFileList
dim oFile
set oShellApp = CreateObject("Shell.Application")
set oFileSys = CreateObject("Scripting.FileSystemObject")
set oShell = CreateObject("WScript.Shell")
Set oFolder = oShellApp.Namespace(APPLICATION_DATA_INDEX)
Set oFolderItem = oFolder.Self
strProofDir = oFolderItem.Path & "\Microsoft\Proof"
' make sure directory exists
if (oFileSys.FolderExists (strProofDir)) then
Set oFolder = oFileSys.GetFolder(strProofDir)
Set oFileList = oFolder.Files
dim basename
dim fullname
dim extension
dim tempfilepath
dim registryValues
registryValues = ""
dim fileCount
fileCount = 0
' loop through all the files in the folder
For each oFile In oFileList
basename = oFileSys.GetBaseName(oFile)
fullname = oFileSys.GetFileName(oFile)
extension = oFileSys.GetExtensionName(oFile)
' move the existing dictionary files to a .old extension
dim oldFilename
oldFilename = strProofDir & "\" & basename & ".OLD"
If UCase(extension) = "DIC" Then
' if a .old already exists, then delete it
if oFileSys.FileExists(oldFilename) then
oFileSys.DeleteFile oldFilename
end if
' move to a .old extension
oFileSys.MoveFile strProofDir & "\" & fullname, oldFilename
dim oldFileHandle
dim newFileHandle
dim tempLine
' if we had a dictionary file, then read its contents and create a new dictionary file
if oFileSys.FileExists(oldFilename) then
set oldFileHandle = oFileSys.OpenTextFile(oldFilename, ForReading, True)
set newFileHandle = oFileSys.CreateTextFile(strProofDir & "\" & basename & ".DIC", True)
Do While Not oldFileHandle.AtEndofStream
tempLine = oldFileHandle.ReadLine
newFileHandle.WriteLine tempLine
Loop
newFileHandle.Close
oldFileHandle.Close
' update registry
fileCount = fileCount + 1
oShell.RegWrite "HKCU\Software\Microsoft\Shared Tools\Proofing Tools\Custom Dictionaries\" & fileCount, strProofDir & "\" & basename & ".DIC"
end if
end if
Next
end if